home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ für Kids
/
C++ for kids.iso
/
Buch
/
Punkte1.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-12-26
|
1KB
|
41 lines
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop
#include "Punkte1.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
const int FMax = 16;
TColor Farbe[FMax] =
{clBlack, clMaroon, clGreen, clNavy, clTeal, clPurple,
clOlive, clGray, clSilver, clRed, clLime, clBlue,
clAqua, clFuchsia, clYellow, clWhite};
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int x,y, Dicke;
for (int i=1; i<500; i++)
{
x = random(ClientWidth);
y = random(ClientHeight);
Dicke = random(20);
// mit Farbe gefⁿllte Kreise zeichnen
Canvas->Brush->Color = Farbe[random(FMax)];
Canvas->Ellipse (x,y,x+Dicke,y+Dicke);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
randomize ();
Color = Farbe [random(FMax/2)];
}
//---------------------------------------------------------------------------